import Abstract from "./axios.Abstract";
interface PageList {
    page: number;
    pageSize: number
}
interface Ids {
    ids: Array<Number>
}

class Basic extends Abstract {

    login(data: object) {
        return this.postReq({ url: "/login", data })
    }

    register(data: object) {
        return this.postReq({ url: "/register", data })
    }

    getUserList() {
        return this.getReq({ url: "/user/getUserList" })
    }

    getUserPageList(data: PageList) {
        return this.postReq({ url: "/user/pageList", data })
    }

    deleteUser(data: object) {
        return this.postReq({ url: "/user/deleteUser", data })
    }
    categoryList() {
        return this.getReq({ url: "/tree-category/list" })
    }
    delCategory(data: Ids) {
        return this.postReq({ url: "/tree-category/delCategory", data })
    }
    updateCategory(data: any) {
        return this.postReq({ url: "/tree-category/updateCategory", data })
    }
    addCategory(data: any) {
        return this.postReq({ url: "/tree-category/addCategory", data })
    }

}
// 单列模式返回对象
let instance;
export default (() => {
    if (instance) return instance;
    instance = new Basic();
    return instance;
})();